<script type="text/javascript" src="system/themes/default/formcheck.js"></script>
<script type="text/javascript">
	window.addEvent('domready', function(){
		new FormCheck('signupForm', {
			display : {
				showErrors : 0,	
				closeTipsButton : 0,
				flashTips : 1
			}
		});
		
		var myCal = new Calendar({ datepicker: 'm/d/Y' });
	});
</script>
<form method="post" class="tl_form" action="typolight/main.php?do=memberlist">
<div class="tl_formbody">
<input type="hidden" value="tl_filters" name="FORM_SUBMIT">

<div class="tl_panel">

<div class="tl_submit_panel tl_subpanel">
<input type="image" value="apply changes" title="Apply" class="tl_img_submit" src="system/themes/default/images/reload.gif" id="filter" name="filter_show">
</div>

<div class="tl_limit tl_subpanel">
<strong>Show:</strong>
<select class="tl_select active" name="tl_limit">
  <option value="">Records</option>
  <?php if ($this->memberCnt > 30): ?>
  <?php 
	$intQuotient = floor($this->memberCnt / 30);
	$intResidue = $this->memberCnt % 30;
	//print_r($this->limitValue);exit;
  ?>
  <?php for ($i = 0;$i < $intQuotient; $i++): ?>
  <option<?php if ($this->limitValue == ($i*30) . "," . ($i+1)*30): ?> selected="selected"<?php endif; ?> value="<?php echo $i*30; ?>,<?php echo ($i+1)*30; ?>"><?php echo $i*30+1; ?> - <?php echo ($i+1)*30; ?></option>
  <?php endfor; ?>
  <option<?php if ($this->limitValue == $i*30 . "," . $intResidue): ?> selected="selected"<?php endif; ?> value="<?php echo $i*30; ?>,<?php echo $intResidue; ?>"><?php echo $i*30+1; ?> - <?php echo $i*30+$intResidue; ?></option>
  <?php else: ?>
  <option selected="selected" value="0,30">1 - 30</option>
  <?php endif; ?>
  <option<?php if ($this->limitValue == "all"): ?> selected="selected"<?php endif; ?> value="all">All</option>
</select> 
</div>

<div class="tl_search tl_subpanel">
<strong>Search:</strong>
<select class="tl_select" name="tl_member_search">
  <option value="username"<?php if ($this->member_search == "username"): ?> selected="selected"<?php endif; ?>>User Name</option>
  <option value="email"<?php if ($this->member_search == "email"): ?> selected="selected"<?php endif; ?>>Email</option>
</select>
<span>=</span>
<input type="text" value="<?php echo $this->search_value; ?>" class="tl_text" name="tl_search_value">
</div>

<div class="clear"></div>

<div id="tl_buttons">
	<a onclick="Backend.getScrollOffset();" title="Export member list" class="header_css_export_memmberlist" href="typolight/main.php?do=memberlist&amp;act=export_memberlist">Export by member lists</a>&nbsp; :: &nbsp; <a onclick="Backend.getScrollOffset();" title="Export wishlist" class="header_css_export_wishlist" href="typolight/main.php?do=memberlist&amp;act=export_wishlist&id_member=<?php echo $this->members['id_member']; ?>">Export wishlist</a><!--&nbsp; :: &nbsp; <a onclick="Backend.getScrollOffset();" title="Export inventory" class="header_css_export_inventory" href="typolight/main.php?do=memberlist&amp;act=export_inventory">Export inventory</a>-->
</div>

</div>
</div>
</form>

<?php if ($this->members): ?>
<div class="main" id="signin">
		<div class="main_left">
	<h3>Member Information</h3>
	<form id="signupForm" action="typolight/main.php?do=memberlist" name="form" method="post">
	<input type="hidden" name="FORM_SUBMIT" value="save" />
	<input type="hidden" name="id_member" value="<?php echo $this->members['id_member']; ?>" />
	<div class="reg_account">
		<label style="display: none;" id="msg_1"><span style="color: green; font-weight: bold;">Your account have been created, and please sign in your account on right side.</span></label>
		<p>
			<label>First Name</label><input type="text" name="firstname" value="<?php echo $this->members['firstname']; ?>" class="ce_text text-input validate['required','nodigit','length[2,-1]']" />
		</p>
		<p>
			<label>Last Name</label><input type="text" name="lastname" value="<?php echo $this->members['lastname']; ?>" class="ce_text text-input validate['required','nodigit','length[2,-1]']" />
		</p>
		<p>
			<label>Email</label><input type="text" id="email" name="email" value="<?php echo $this->members['email']; ?>" class="ce_text validate['required','email'] text-input" />
		</p>
		<p>
			<label>Password</label><input type="password" id="password" name="password" value="" class="ce_text" />
		</p>
		<p>
			<label>Confirm Password</label><input type="password" id="confirm_password" name="confirm_password" value="" class="ce_text" />
		</p>
		<?php if ($this->members['mobile']): ?>
		<p>
			<label>Mobile</label><label><?php echo $this->members['mobile']; ?></label>
		</p>
		<?php endif; ?>
	</div> <!-- reg_account end -->
	<div class="optional">
		<h4>Tell us more about you... (optional)</h4>
		<p>
			<span class="gender"><strong>Gender</strong> <input type="radio" name="gender" value="male" class="checkbox"<?php if ($this->members['gender'] == 'male'): ?> checked="checked"<?php endif; ?> />M <input type="radio" name="gender" value="female" class="checkbox"<?php if ($this->members['gender'] == 'female'): ?> checked="checked"<?php endif; ?> />F</span>
			<span class="birthday">
				<strong>Birthday</strong>
				<input type="text" name="birthday" id="datepicker" value="<?php echo date('m/d/Y', $this->members['dateOfBirth']); ?>" />
			</span>
			<span class="currency"><strong>Currency</strong>:&nbsp;<?php echo $this->members['cur']; ?></span>
		</p>
		<h5>In which city do you spend most of your time other than where you live?</h5>
		<p>
			<select class="most_time" name="province">
				<option value="">Please select province</option>
				<?php foreach ($this->arrSates as $key=>$strStatesInfo): ?>
				<?php if ($key == $this->members['state']): ?>
					<option value="<?php echo $key; ?>" selected="selected"><?php echo $strStatesInfo; ?></option>";
				<?php else: ?>
					<option value="<?php echo $key; ?>"><?php echo $strStatesInfo; ?></option>
				<?php endif; ?>
				<?php endforeach; ?>
			</select>
			<select class="some_time" name="city">
				<option value="">Please select city</option>";
			<?php foreach ($this->arrCitys as $key=>$strCity): ?>
			<?php if ($key == $this->members['city']): ?>
					<option value="<?php echo $key; ?>"  selected="selected"><?php echo $strCity; ?></option>
			<?php else: ?>
					<option value="<?php echo $key; ?>"><?php echo $strCity; ?></option>
			<?php endif;endforeach; ?>
			</select>
			<?php 
				$arrSocial = $this->members['social'];
				$arrnewsletter = unserialize($objMember->newsletter);
				$is_newsletter = $arrnewsletter[0];
			?>			
		</p>
		<h5>Your social networks</h5>
		<p class="social">
			<label><input type="checkbox" name="social[]" value="Facebook" class="checkbox"<?php if (in_array('Facebook', $arrSocial)): ?> checked="checked"<?php endif; ?> />Facebook</label>
			<label><input type="checkbox" name="social[]" value="My Space" class="checkbox"<?php if (in_array('My Space', $arrSocial)): ?> checked="checked"<?php endif; ?> />My Space</label>
			<label><input type="checkbox" name="social[]" value="Renren" class="checkbox"<?php if (in_array('Renren', $arrSocial)): ?> checked="checked"<?php endif; ?> />Renren</label>
			<label><input type="checkbox" name="social[]" value="Kaixin" class="checkbox"<?php if (in_array('Kaixine', $arrSocial)): ?> checked="checked"<?php endif; ?> />Kaixin</label>
			<label><input type="checkbox" name="social[]" value="Twitter" class="checkbox"<?php if (in_array('Twitter', $arrSocial)): ?> checked="checked"<?php endif; ?> />Twitter</label>
			<label><input type="checkbox" name="social[]" value="Flickr" class="checkbox"<?php if (in_array('Flickr', $arrSocial)): ?> checked="checked"<?php endif; ?> />Flickr</label>
			<label><input type="checkbox" name="social[]" value="Tudou" class="checkbox"<?php if (in_array('Tudou', $arrSocial)): ?> checked="checked"<?php endif; ?> />Tudou</label>
			<label><input type="checkbox" name="social[]" value="City Weekend" class="checkbox"<?php if (in_array('City Weekend', $arrSocial)): ?> checked="checked"<?php endif; ?> />City Weekend</label>
		</p>
	</div> <!-- optional end -->
	<?php if ($this->members['addressbook']): ?>
	
	<h3>Address Book</h3>
	<div class="cons">
	<ol>
	<?php $index = 0; foreach ($this->members['addressbook'] as $arrStrAddr): ?>
		
		<li><?php echo $arrStrAddr['add_firstname']; ?> <?php echo $arrStrAddr['add_lastname']; ?>, <br />
		<?php echo $arrStrAddr['add_street']; ?>
		<?php if ($arrStrAddr['add_street_2']=="line 2" || $arrStrAddr['add_street_2'] == "Address line 2"): ?>
		<?php echo ""; ?>
		<?php else: ?>
		<br /><?php echo $arrStrAddr['add_street_2']; ?>
		<?php endif; ?>, 
		
		<?php echo $this->arrCitys[$arrStrAddr['add_city']]; ?><br/>
		<?php echo $this->arrSates[$arrStrAddr['add_state']]; ?> <?php echo $arrStrAddr['add_postcode']; ?> <?php echo $this->arrCountries[$arrStrAddr['add_country']]; ?></li>
	<?php $index++; ?>
	<?php endforeach;endif; ?>
	</ol>
	</div>
	<div class="tl_listing_container">
	<table cellspacing="0" cellpadding="0" summary="Table lists records" class="tl_listing">
		<tbody>
			<?php if ($this->members['orders']): ?>
			<?php $arrKeys = array_keys($this->members['orders'][0]); ?>
			<tr>
			<?php foreach ($arrKeys as $key=>$strKey): ?>	
			<?php if ($key == 0):  continue; endif; ?>
				<th><?php echo $GLOBALS['TL_LANG']['tl_memberlist'][$strKey]; ?></th>			
			<?php endforeach; ?>
			</tr>
			<?php foreach ($this->members['orders'] as $key=>$arrOrder): ?>
			<tr>
				<!-- oder number -->
				<td class="tl_folder_tlist"><a href="typolight/main.php?do=orderlist&act=detail&id=<?php echo $arrOrder['id_order']; ?>" title="order detail"><?php echo $arrOrder['orderno']; ?></a></td>
				<td class="tl_folder_tlist"><?php echo $arrOrder['date_add']; ?></td>
				<td class="tl_folder_tlist"><?php echo $arrOrder['memberName']; ?></td>
				<td class="tl_folder_tlist"><?php echo $arrOrder['total_paid_real']; ?></td>
				<td class="tl_folder_tlist"><?php echo $arrOrder['status']; ?></td>
			</tr>
			<?php endforeach;endif; ?>
		</tbody>
	</table>
</div>
<!-- wishlist -->
<?php if ($this->members['wishlists']): ?>
<div class="tl_listing_container">
	<table cellspacing="0" cellpadding="0" summary="Table lists records" class="tl_listing">
		<tbody>
			<?php if ($this->members['wishlists']): ?>
			<?php $arrKeys = array_keys($this->members['wishlists'][0]); ?>
			<tr>
			<?php foreach ($arrKeys as $key=>$strKey): ?>	
			<?php if ($key == 0 || $key == 1 || $key == 2 || $key == 3):  continue; endif; ?>
				<th><?php echo $GLOBALS['TL_LANG']['tl_memberlist'][$strKey]; ?></th>			
			<?php endforeach; ?>
			</tr>
			<?php foreach ($this->members['wishlists'] as $key=>$arrWishlist): ?>
			<tr>
				<!-- oder number -->
				<td class="tl_folder_tlist" style="width:5%"><a href="product.html?category=<?php echo $arrWishlist['id_category']; ?>&id=<?php echo $arrWishlist['id_catalog']; ?>&id_color=<?php echo $arrWishlist['id_color']; ?>&id_size=<?php echo $arrWishlist['id_size']; ?>##product_detail" title="order detail" onclick="window.open('product.html?category=<?php echo $arrWishlist['id_category']; ?>&id=<?php echo $arrWishlist['id_catalog']; ?>&id_color=<?php echo $arrWishlist['id_color']; ?>&id_size=<?php echo $arrWishlist['id_size']; ?>##product_detail');return false;"><?php echo $arrWishlist['skuid']; ?></a></td>
				<td class="tl_folder_tlist" style="width:15%"><?php echo $arrWishlist['category']; ?></td>
				<td class="tl_folder_tlist" style="width:15%"><?php echo $arrWishlist['subcategory']; ?></td>
				<td class="tl_folder_tlist" style="width:30%"><?php echo $arrWishlist['productname']; ?></td>
				<td class="tl_folder_tlist" style="width:13%"><?php echo $arrWishlist['color']; ?></td>
				<td class="tl_folder_tlist" style="width:12%"><?php echo $arrWishlist['size']; ?></td>
			</tr>
			<?php endforeach;endif; ?>
		</tbody>
	</table>
</div>
<?php endif; ?>
<!-- end wishlist -->
	<!--<p class="submits"><input type="submit" name="submit" value="UPDATE PROFILE" class="submit" /></p>-->
</form></div></div>
<?php endif; ?>